home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Comms Spectacular / AppleTalk Remote Access / Direct Link Folder / Direct Link < prev   
Encoding:
Text File  |  1993-04-08  |  2.5 KB  |  149 lines  |  [mlts/slnk]

  1. !
  2. ! The ARA script for Direct Connection
  3. ! (i.e. for a direct serial link or for other links with PortConnector™ installed)
  4. ! The "phone number" parameter is used to set the desired port speed,
  5. ! the values supported are: 2400, 4800, 9600, 19200, 38400, 57600
  6. !
  7. ! version:1.0
  8. ! Copyright © 1993, Stalker GmbH
  9. !
  10. @Hangup
  11.  DTRClear
  12.  pause 10
  13.  DTRSet
  14.  Flush
  15.  exit 0
  16. !
  17. ! Originating a call:
  18. ! • Set a magic sequence on 300 bps
  19. ! • Wait for the correct response
  20. ! • Say him the desired speed, switch to this speed
  21. ! • And wait for the correct response
  22. !
  23. @Originate
  24.  SerReset 300,0,8,1
  25.  SetTries 3
  26. @Label 10
  27.   Flush
  28.   MatchClr
  29.   MatchStr 1 12 "@@DIRECT OK@@"
  30.   Write "\13\10@@DIRECT?@@\13\10"
  31.   MatchRead 100
  32.   Flush
  33.   DecTries
  34.   IfTries 0 10
  35.   Exit -6023
  36. !
  37. ! Now - say him the desired speed
  38. !
  39. @Label 12
  40.   IfStr 1 21 "2400"
  41.   IfStr 1 22 "4800"
  42.   IfStr 1 23 "9600"
  43.   IfStr 1 20 "19200"
  44.   IfStr 1 24 "38400"
  45.   IfStr 1 25 "57600"
  46. !
  47. ! All others - 19200
  48.   Note "'^1' is not supported. Using 19200bps…" 2
  49.   Pause 20
  50. @Label 20
  51.   Write "@19200\13\10"
  52.   Pause 5
  53.   SetSpeed 19200
  54.   Jump 30
  55. @Label 21
  56.   Write "@2400\13\10"
  57.   Pause 5
  58.   SetSpeed 2400
  59.   Jump 30
  60. @Label 22
  61.   Write "@4800\13\10"
  62.   Pause 5
  63.   SetSpeed 4800
  64.   Jump 30
  65. @Label 23
  66.   Write "@9600\13\10"
  67.   Pause 5
  68.   SetSpeed 9600
  69.   Jump 30
  70. @Label 24
  71.   Write "@38400\13\10"
  72.   Pause 5
  73.   SetSpeed 38400
  74.   Jump 30
  75. @Label 25
  76.   Write "@57600\13\10"
  77.   Pause 5
  78.   SetSpeed 57600
  79.   Jump 30
  80. !
  81. @Label 30
  82.   MatchClr
  83.   MatchStr 1 31 "@CONNECT\13\10"
  84.   MatchRead 50
  85.   Exit -6021
  86. @Label 31
  87.   Note "Connected" 2
  88.   Pause 15
  89.   Exit 0
  90. !
  91. ! Waiting for and answering incoming connection requests
  92. !
  93. @Answer
  94.  SerReset 300,0,8,1
  95. @Label 50
  96.  Flush
  97.  MatchClr
  98.  MatchStr 1 51 "@@DIRECT?@@"
  99.  MatchRead 700
  100.  Jump 50
  101. @Label 51
  102.  Note "Incoming Request…" 2
  103.  UserHook 1
  104.  MatchClr
  105.  MatchStr 1 60 "@2400\13"
  106.  MatchStr 2 61 "@4800\13"
  107.  MatchStr 3 62 "@9600\13"
  108.  MatchStr 4 63 "@19200\13"
  109.  MatchStr 5 64 "@38400\13"
  110.  MatchStr 6 65 "@57600\13"
  111.  Write "\13\10@@DIRECT OK@@\13\10"
  112.  MatchRead 50
  113.  Exit -6021
  114. !
  115. ! Process the speed change request
  116. @Label 60
  117.   Note "Communicating at 2400bps" 2 
  118.   SetSpeed 2400
  119.   Jump 70
  120. @Label 61
  121.   Note "Communicating at 4800bps" 2 
  122.   SetSpeed 4800
  123.   Jump 70
  124. @Label 62
  125.   Note "Communicating at 9600bps" 2 
  126.   SetSpeed 9600
  127.   Jump 70
  128. @Label 63
  129.   Note "Communicating at 19200bps" 2 
  130.   SetSpeed 19200
  131.   Jump 70
  132. @Label 64
  133.   Note "Communicating at 38400bps" 2 
  134.   SetSpeed 38400
  135.   Jump 70
  136. @Label 65
  137.   Note "Communicating at 57600bps" 2 
  138.   SetSpeed 57600
  139.   Jump 70
  140. !
  141. ! Set the Final response
  142. !
  143. @Label 70
  144.  Pause 10
  145.  Flush
  146.  Write "\13\10@CONNECT\13\10"
  147.  Pause 5
  148.  Exit 0
  149. !